package com.haidechizi.i18n.code.generator.common.dynamic.param;

import com.haidechizi.i18n.code.generator.common.dynamic.enums.I18nTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
public class DynamicI18nConfig {

    // 文件路径
    private String filePath;
    private String keyGeneratorType;    // 0。不处理，1.驼峰
    private String systemCode;
    private String businessCode;
    private String businessKey;
    private String i18nModelReplacePattern;
    private List<I18nFieldConfig> configList = new ArrayList<>(16);

    private boolean backupFile;
    private boolean generateNewFile;
    private boolean replaceFile;

    public void addI18nField(I18nFieldConfig i18nFieldConfig) {
        this.configList.add(i18nFieldConfig);
    }


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class I18nFieldConfig {

        private boolean translate;
        private String systemCode;
        private String businessCode;
        private String businessKey;
        private String value;
        private String metaCalculator;
        private String i18nFieldReplacePattern;
        private int i18nType;

        public I18nFieldConfig(String value, String i18nFieldReplacePattern) {
            this.value = value;
            this.i18nFieldReplacePattern = i18nFieldReplacePattern;
            this.translate = false;
            this.businessKey = "id";
            this.i18nType = I18nTypeEnum.SIMPLE.getType();
        }
    }


}
